/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ongmanager.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author wbettencourt
 */
@Entity
@Table(name = "status_ong")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "StatusOng.findAll", query = "SELECT s FROM StatusOng s"),
    @NamedQuery(name = "StatusOng.findByFecha", query = "SELECT s FROM StatusOng s WHERE s.fecha = :fecha"),
    @NamedQuery(name = "StatusOng.findByObservacion", query = "SELECT s FROM StatusOng s WHERE s.observacion = :observacion"),
    @NamedQuery(name = "StatusOng.findByIdStatus", query = "SELECT s FROM StatusOng s WHERE s.statusOngPK.idStatus = :idStatus"),
    @NamedQuery(name = "StatusOng.findByIdOng", query = "SELECT s FROM StatusOng s WHERE s.statusOngPK.idOng = :idOng")})
public class StatusOng implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected StatusOngPK statusOngPK;
    @Basic(optional = false)
    @Column(name = "Fecha")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecha;
    @Column(name = "Observacion")
    private String observacion;
    @JoinColumn(name = "IdStatus", referencedColumnName = "IdStatus", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Status status;
    @JoinColumn(name = "IdOng", referencedColumnName = "IdONG", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Ong ong;

    public StatusOng() {
    }

    public StatusOng(StatusOngPK statusOngPK) {
        this.statusOngPK = statusOngPK;
    }

    public StatusOng(StatusOngPK statusOngPK, Date fecha) {
        this.statusOngPK = statusOngPK;
        this.fecha = fecha;
    }

    public StatusOng(int idStatus, int idOng) {
        this.statusOngPK = new StatusOngPK(idStatus, idOng);
    }

    public StatusOngPK getStatusOngPK() {
        return statusOngPK;
    }

    public void setStatusOngPK(StatusOngPK statusOngPK) {
        this.statusOngPK = statusOngPK;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public String getObservacion() {
        return observacion;
    }

    public void setObservacion(String observacion) {
        this.observacion = observacion;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public Ong getOng() {
        return ong;
    }

    public void setOng(Ong ong) {
        this.ong = ong;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (statusOngPK != null ? statusOngPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StatusOng)) {
            return false;
        }
        StatusOng other = (StatusOng) object;
        if ((this.statusOngPK == null && other.statusOngPK != null) || (this.statusOngPK != null && !this.statusOngPK.equals(other.statusOngPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ongmanager.model.StatusOng[ statusOngPK=" + statusOngPK + " ]";
    }
    
}
